﻿using System;
using AMS.Core.Entities;
using VitCode.Castle.Entities;

namespace AMS.WorkBill.Entities
{
    /// <summary>
    /// 工单命令行
    /// </summary>
    public class WoCommand
    {
        public static string STATE_SELECTED = "Selected", STATE_SET = "Set", STATE_EXEC = "Exec";
        protected AssetInfo m_AssetInfo;
        protected string m_ExMemo1;
        protected string m_Flag;
        protected Guid m_Id;
        protected AssetState m_OrgState;
        protected Site m_OrgSite;
        protected User m_OrgUser;
        protected UserGroup m_OrgUserGroup;
        protected Site m_TargetSite;
        protected User m_TargetUser;
        protected UserGroup m_TargetUserGroup;
        protected string m_TypeName;
        protected string m_TargetLocation;
        protected string m_OrgLocation;
        protected AssetState m_TargetState;
        protected double m_OrgValue;
        protected double m_TargetValue;
        protected string m_WoCode;
        protected Guid m_WoInfoHistoryId;

        /// <summary>
        /// 重写Equals方法
        /// </summary>
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(obj, this))
                return true;
            if (obj == null)
                return false;
            var sObj = obj as WoCommand;
            return sObj != null && (sObj.Id == m_Id || (sObj.WoCode == m_WoCode && sObj.AssetInfo == m_AssetInfo));
        }

        /// <summary>
        /// 重写GetHashCode方法
        /// </summary>
        public override int GetHashCode()
        {
            int hash = 274;
            hash = 27 * hash * m_Id.GetHashCode();
            return hash;
        }

        /// <summary>
        /// 数据唯一标识
        /// </summary>
        public virtual Guid Id
        {
            get { return m_Id; }
            set { m_Id = value; }
        }

        /// <summary>
        /// 工单编号
        /// </summary>
        public virtual string WoCode
        {
            get { return m_WoCode; }
            set { m_WoCode = value; }
        }

        public virtual AssetInfo AssetInfo
        {
            get { return m_AssetInfo; }
            set { m_AssetInfo = value; }
        }

        public virtual Site OrgSite
        {
            get { return m_OrgSite; }
            set { m_OrgSite = value; }
        }

        public virtual AssetState OrgState
        {
            get { return m_OrgState; }
            set { m_OrgState = value; }
        }

        public virtual Site TargetSite
        {
            get { return m_TargetSite; }
            set { m_TargetSite = value; }
        }

        public virtual User OrgUser
        {
            get { return m_OrgUser; }
            set { m_OrgUser = value; }
        }

        public virtual string TargetLocation
        {
            get { return m_TargetLocation; }
            set { m_TargetLocation = value; }
        }

        public virtual string OrgLocation
        {
            get { return m_OrgLocation; }
            set { m_OrgLocation = value; }
        }

        public virtual User TargetUser
        {
            get { return m_TargetUser; }
            set { m_TargetUser = value; }
        }

        public virtual UserGroup OrgUserGroup
        {
            get { return m_OrgUserGroup; }
            set { m_OrgUserGroup = value; }
        }

        public virtual UserGroup TargetUserGroup
        {
            get { return m_TargetUserGroup; }
            set { m_TargetUserGroup = value; }
        }

        public virtual string TypeName
        {
            get { return m_TypeName; }
            set { m_TypeName = value; }
        }

        public virtual string Flag
        {
            get { return m_Flag; }
            set { m_Flag = value; }
        }

        public virtual AssetState TargetState
        {
            get { return m_TargetState; }
            set { m_TargetState = value; }
        }

        public virtual string ExMemo1
        {
            get { return m_ExMemo1; }
            set { m_ExMemo1 = value; }
        }

        public virtual Guid WoInfoHistoryId
        {
            get { return m_WoInfoHistoryId; }
            set { m_WoInfoHistoryId = value; }
        }

        public virtual double OrgValue
        {
            get { return m_OrgValue; }
            set { m_OrgValue = value; }
        }

        public virtual double TargetValue
        {
            get { return m_TargetValue; }
            set { m_TargetValue = value; }
        }
    }
}